package com.hyc.myvideo.widget;


import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Typeface;
import android.util.AttributeSet;

/**
 * 自定义礼物字体
 * @author gyb
 * @version 1.0
 * @created 2017/7/27
 */
public class GiftFortTextViewNum extends android.support.v7.widget.AppCompatTextView {
    public GiftFortTextViewNum(Context context) {
        super(context);
        init(context);
    }
    public GiftFortTextViewNum(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public GiftFortTextViewNum(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

//    @Override
//    protected void onLayout(boolean changed,int left, int top, int right, int bottom) {
//        super.onLayout(changed, left, top, right, bottom);
//        if (changed) {
//            getPaint().setShader(new LinearGradient(0, 0, 0, getHeight(), R.color.color_9, R.color.color10, Shader.TileMode.REPEAT));
//        }
//    }

    private void init(Context context) {
        AssetManager assertMgr = context.getAssets();
        Typeface font = Typeface.createFromAsset(assertMgr, "fonts/tintin_talking.ttf");
        setTypeface(font);
    }
}
